About 900 letters

About 5 minutes

#staticmethod

Description: Encapsulate a method as a static method. Refer to the classmethod function.

def staticmethod(fn):
    '''
    Encapsulate a method as a static method

    :param fn: The method to encapsulate
    :return: The encapsulated method
    '''

Example:

class Cat:

    @staticmethod
    def speak():
        print('Meow Meow Meow')

# Call via the class
Cat.speak()

# Call via an instance
cat = Cat()
cat.speak()

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Updated: 6/9/2025

Author: PlanC

Created: 6/9/2025